package com.jiali.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiali.backend.model.AppointmentOrder;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
import java.util.Map;


/**
* @author piko
* @description 针对表【appointment_order(预约订单)】的数据库操作Mapper
* @createDate 2025-03-20 19:20:42
* @Entity generator.domain.AppointmentOrder
*/
public interface AppointmentOrderMapper extends BaseMapper<AppointmentOrder> {
    @Select("SELECT DATE_FORMAT(appointment_time, '%Y-%m') as month, COUNT(*) as count " +
            "FROM appointment_order " +
            "WHERE appointment_time BETWEEN #{startDate} AND #{endDate} " +
            "GROUP BY DATE_FORMAT(appointment_time, '%Y-%m')")
    List<Map<String, Object>> selectMonthlyOrderTrend(Date startDate, Date endDate);
}




